package com.hugboy.string;

import java.util.Scanner;

public class Demo4Login {
    public static void main(String[] args) {
        for(int i=0; i<=2; i++){
            String username = "admin";
            String password = "123456";

            Scanner sc = new Scanner(System.in);
            System.out.println("username:");
            String scUname = sc.nextLine();
            System.out.println("password:");
            String scPword = sc.nextLine();

            if(username.equals(scUname) && password.equals(scPword)){
                System.out.println("Login Success.");
                break;
            }else{
                if(i==2){
                    System.out.println("login limit 3 times. please try again tomorrow !");
                    break;
                }
                System.out.println("Login False. have "+(2-i)+" chance !");
            }
        }
    }
}
